home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / os2 / wuz11a.zip / OPEN-DIR.CMD < prev    next >
OS/2 REXX Batch file  |  1994-02-04  |  1KB  |  56 lines

  1. /* Open folder on desktop from command-line */
  2. /* (c) Copyright 1994 Scott Maxwell.        */
  3.  
  4. /* Note: If you installed this with WUZ, this file */
  5. /*       may have also been created as OD.CMD      */
  6. /*       In that case, you can easily open folders */
  7. /*       on your desktop by typing something like  */
  8. /*       'od c:\os2'                   */
  9.  
  10.  
  11. arg Name Options
  12.  
  13. if (Left(Name,1) = '/') | (Left(Name,1) = '-') then do
  14.   swap = Name
  15.   Name = Options
  16.   Options = swap
  17.   end
  18.  
  19. if Options \= '' then
  20.   if (Options \= '/C') & (Options \= '-C') then do
  21.     say "USAGE: Open-Dir [-c] [directory-name]"
  22.     say "  Opens the specified directory as a folder on the desktop"
  23.     say "  If no directory-name is specified, the current directory is opened"
  24.     say "  If -c option is specified, the current directory is changed"
  25.     exit(0)
  26.     end
  27.  
  28. Dir.1 = DIRECTORY()
  29. Dir.2 = ''
  30. if Name \= '' then
  31.   if SubStr(Name,2,1) = ':' then do
  32.     Dir.2 = DIRECTORY(Left(Name,2))
  33.     Name = SubStr(Name,3)
  34.     end
  35.  
  36. Name = Directory(Name)
  37.  
  38. CALL RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData'
  39. CALL SysSetObjectData Name,"OPEN=ICON"
  40. if Options = '' then do
  41.   if Dir.2 \= '' then call Directory(Dir.2)
  42.   call Directory(Dir.1)
  43.   end
  44.  
  45. exit(0)
  46.  
  47.  
  48. Directory: procedure
  49.   arg Name
  50.   if Length(Name) > 3 then
  51.     if Right(Name,1) = '\' then
  52.       Name = Left(Name,LENGTH(Name)-1)
  53.  
  54.   n = 'DIRECTORY'(Name)
  55.   return n
  56.